<template>
	<view>
		<zmm-watermark :watermark="userStore.watermark" v-if="userStore.watermark"></zmm-watermark>
		<view class="content detail">
			<!--商品批次信息-->
			<view class="detail-item">
				<uni-section title="商品批次信息" type="line"></uni-section>
				<view class="detail-content">
					<view class="detail-text">
						批次号：
						<text>{{info.batchNumber}}</text>
						<text class="detail-text-copy" @click="copyText(info.batchNumber)">复制</text>
					</view>
					<view class="detail-text">
						商品名称：
						<text>{{info.productName}}</text>
					</view>
					<view class="detail-text">
						仓库名称：
						<text>{{info.warehouseName}}</text>
					</view>
					<view class="detail-text">
						商品单位：
						<text>{{info.unit}}</text>
					</view>
					<view class="detail-text">
						商品数量：
						<text>{{info.number}}</text>
					</view>
					<view class="detail-text">
						生产日期：
						<text>{{info.productionDate}}</text>
					</view>
					<view class="detail-text">
						过期日期：
						<text>{{info.expireDate}}</text>
					</view>
					<view class="detail-text">
						创建日期：
						<text>{{info.createTime}}</text>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { computed, onMounted, ref } from 'vue';
import { tab, auth, modal } from "@/plugins"
import { getTitle } from "@/utils/getter"
import { checkPermi, checkRole, checkOnlyPermi, checkOnlyRole } from "@/utils/permission"
import { storageProductDetail } from "@/api/erp_api/storageProduct"
import { copyText, arrText, previewImg } from '@/utils/ty.js';
import useUserStore from '@/store/modules/user'

	const userStore = useUserStore()
	onLoad((option) => {
		if (option.id) {
			id.value = option.id
			getDetail()
		}
	})
	
	// 数据查询
	const id = ref('')
	const info = ref({})
	const isLoading = ref(false)
	
	const getDetail = () => {
		const params = {
			id: id.value
		}
		isLoading.value = true
		uni.showLoading({
			title: '数据加载中...'
		})
		storageProductDetail(params).then(res => {
			info.value = res.data || {}
			isLoading.value = false
			uni.hideLoading()
    }).catch(() => {
			isLoading.value = false
			uni.hideLoading()
		})
	}
	
</script>

<style scoped lang="scss">
	.record-type-0 {
		background-color: #e7faf0;
		border-color: #d0f5e0;
		color: #13ce66;
		padding: 2px 6px !important;
	}
	.record-type-1 {
		background-color: #ffeded;
		border-color: #ffdbdb;
		color: #ff4949;
		padding: 2px 6px !important;
	}
</style>
